<admintpl file="header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('user/index')}">{:L('ADMIN_USER_INDEX')}</a></li>
			<li class="active"><a href="{:U('user/add')}">{:L('ADMIN_USER_ADD')}</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" action="{:U('User/add_post')}">
			<fieldset>
				<div class="control-group">
					<label class="control-label">{:L('USERNAME')}</label>
					<div class="controls">
						<input type="text" name="user_login">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">{:L('PASSWORD')}</label>
					<div class="controls">
						<input type="password" name="user_pass">
					</div>
				</div>
                <div class="control-group">
                    <label class="control-label">姓名</label>
                    <div class="controls">
                        <input type="text" name="user_nicename">
                    </div>
                </div>
				<!--<div class="control-group">-->
					<!--<label class="control-label">{:L('EMAIL')}</label>-->
					<!--<div class="controls">-->
						<!--<input type="text" name="user_email">-->
					<!--</div>-->
				<!--</div>-->
				<div class="control-group">
					<label class="control-label">{:L('ROLE')}</label>
					<div class="controls">
						<foreach name="roles" item="vo">
							<if condition="$vo['id'] != 1">
								<label class="checkbox inline"><input value="{$vo.id}" onchange="change_role()" type="radio" name="role_id" <if condition="sp_get_current_admin_id() neq 1 && $vo['id'] eq 1">disabled="true"</if>>&nbsp;&nbsp;{$vo.name}&nbsp;&nbsp;</label>
							</if>
						</foreach>
					</div>
				</div>
                <div class="control-group logistics_list" style="display: none;">
                    <label class="control-label">物流公司</label>
                    <div class="controls">
                        <select name="organize_id1">
                            <option value="">请选择</option>
                            <foreach name="logistics_list" item="litem">
                                <option value="{$litem['id']}">{$litem.logistics_name}</option>
                            </foreach>
                        </select>
                    </div>
                </div>
                <div class="control-group sale_list" style="display: none;">
                    <label class="control-label">消费机构</label>
                    <div class="controls">
                        <select name="organize_id2">
                            <option value="">请选择</option>
                            <foreach name="sale_list" item="sitem">
                                <option value="{$sitem['id']}">{$sitem.sale_name}</option>
                            </foreach>
                        </select>
                    </div>
                </div>
			</fieldset>
			<div class="form-actions">
				<input type="hidden" name="model" value=""/>
				<button type="submit" class="btn btn-primary js-ajax-submit">{:L('ADD')}</button>
				<a class="btn" href="javascript:history.back(-1);">{:L('BACK')}</a>
			</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
<script>
	function change_role(){
		var role_id = $("input[name='role_id']:checked").val();
		console.log(role_id);
		if(role_id  == 3){	//消费机构
			$(".sale_list").show();
			$(".logistics_list").hide();
		}
		if(role_id == 2){	//物流公司
			$(".sale_list").hide();
			$(".logistics_list").show();
		}
		if(role_id == 4){	//管理员
			$(".sale_list").hide();
			$(".logistics_list").hide();
		}
		$("input[name='model']").val(role_id);
	}
</script>
</body>
</html>